package com.briup.recognition.service.impl;

import com.briup.recognition.bean.BaseRole;
import com.briup.recognition.bean.BaseRoleExample;
import com.briup.recognition.dao.BaseRoleMapper;
import com.briup.recognition.service.IBaseRoleService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @program: recognition
 * @description:
 * @author: lipeian
 * @create: 2021-03-28 17:40
 **/
@Service
public class BaseRoleServiceImpl implements IBaseRoleService {

    @Resource
    private BaseRoleMapper baseRoleMapper;

    @Override
    public List<BaseRole> query() {
        BaseRoleExample example = new BaseRoleExample();
//        ..

        return baseRoleMapper.selectByExample(example);
    }

    @Override
    public void saveOrUpdate(BaseRole baseRole) {
        if (baseRole.getId() != null){
            baseRoleMapper.updateByPrimaryKey(baseRole);
        }else {
            baseRoleMapper.insert(baseRole);
        }
    }

    @Override
    public void deleteById(long id) {
        baseRoleMapper.deleteByPrimaryKey(id);
    }
}
